home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Technotools
/
Technotools (Chestnut CD-ROM)(1993).ISO
/
lang_c
/
cgraphix
/
cinterp.c
< prev
next >
Wrap
Text File
|
1986-05-28
|
1KB
|
73 lines
/* «RM120»«PL99999»«TS4,8,12,16,20,24,28,32,36,40,44,48,52,56,60,64,68,72,76» */
#include <stdio.h>
#define EXTERN extern
#include <typedef.h>
void SplineDem()
{
extern double random();
double x,temp;
int dx,dy,i,n,m,lines,scale;
int X1,Y1,X2,Y2;
PlotArray b,a;
DefineWindow(1,0,0,XMaxGlb,YMaxGlb);
DefineWindow(2,0,0,XMaxGlb,YMaxGlb);
DefineWorld(1, 0., 0., 1000., 1000.);
DefineHeader(2,"A spline interpolation");
SetHeaderOn();
n = 12;
for (i = 0; i < n; i++) {
a[2 * i] = i;
a[2 * i + 1] = random()-0.5;
}
m = 50;
spline(a,n,a[2],a[2 * n - 4],b,m);
FindWorld(2,b,m,(double)1,(double)1.08);
temp = world[2].y1;
world[2].y1 = world[2].y2;
world[2].y2 = temp;
SelectWindow(2);
DrawBorder();
dx = -8;
dy = 7;
X1 = 3;
Y1 = 5;
X2 = 25;
Y2 = 10;
lines = 0;
scale = 0;
DrawAxis(dx,dy,X1,Y1,X2,Y2,lines,scale,FALSE);
SetLineStyle(1);
DrawPolygon(a,0,-n,7,2,0);
SetLineStyle(0);
DrawAxis(0,0,X1,Y1,X2,Y2,0,0,FALSE);
DrawPolygon(b,0,-m,0,0,0);
SelectWorld(1);
SelectWindow(1);
DrawTextW((double)730,(double)400,1,"\0337@2 The data");
DrawTextW((double)730,(double)500,1,".. The initial polygon");
DrawTextW((double)730,(double)600,1,"__ The interpolated values");
}
main()
{
InitGraphic();
SplineDem();
inkey();
LeaveGraphic();
}